
// import "./vue.js";
// import "./param.js";
// import "./axios.min.js";
// import "./page.js";

// document.write('<script src="./page.js" type="text/javascript" charset="utf-8"></script>');


window.onload = function () {
    

    var vm = new Vue({
        el: "#app",
        data: {

            //页面展示
            home: true,
            freightManagement: false,
            statistics: false,
            salary: false,
            manager: false,
            deptAdd: false,
            // adminAdd: false,
            details: false,
            //用户状态修改
            changeUserStatusPop:false,
            //批量修改房间状态
            bacthchangeRoomStatusPop:false,
            updateChangePop:false,
            insertSinglePop:false,
            addBuildingsPop:false,   
            bacthchangeBuildingStatusPop:false, 
            paied:false,                                                      

            //请求路径
            baseurl: "http://localhost:8089",

            //用户列表
            userPage: {},
            userControlPageNum:1,
            //业主新增
            age: "",
            gender: "",
            idcard: "",
            //user_roomid直接使用级联查询的room
            username: "",

            //楼栋、楼层、房间联动
            building: "",
            floor: "",
            room: "",

            buildings: [],
            floors: [],
            rooms: [],
            
            //用户详细信息
            userDetail : [],

            //修改用户状态
            userID : "",
            oldStatus:"",
            newStatus:"",

            
            //房间当前页
            // roomCurrent: 1,
            roomPage:{},
            roomControlPageNum:1,
            
            //批量修改房间状态
            //房间id列表
            roomId : [],
            roomStatus:"",

            //费率
            rate:[],
            //费率修改
            feeName: "",
            feePrice:"",
            feeIntro:"",
            feeID: "",

            //建筑分页信息
            buildingPage:{},
            buildingControlPageNum:1,

            //新增单个建筑
            buildingCode: "",
            buildingName: "",
            buildingFloors:"",
            buildingStatus:"",
            completedDate: "",
            desginLife:"",
            ownership:"",

            //新增多个建筑
            buildingSize:"",
            buildingArea:"",
            //批量修改楼栋状态
            batchBuildingStatus:"",
            buildingIds:[],

            //欠费查询
            unPaiedType:1,
            unPaiedControlPageNum:1,
            unPaiedPage:{},

            //支付信息查询
            // pay_building:"",
            // pay_floor:"",
            startDate:"",
            endDate:"",
            pay_username:"",
            pay_idCard:"",
            payPage:{},
            payControlPageNum:1,

        },
        methods: {

            homeShow: function (num) {
                this.home = true;
                this.freightManagement = false;
                this.statistics = false,
                    this.salary = false;
                this.manager = false;
                this.deptAdd = false;
                // this.adminAdd = false;
                this.details = false;
                this.paied = false;
                document.getElementById("list0").classList.add("click1");
                this.removeClicklClassName(num);

                this.userControlPageNum = 1;
                this.userList(1);

            },
            freightManagementShow: function (num) {
                this.home = false;
                this.freightManagement = true;
                this.statistics = false,
                    this.salary = false;
                this.manager = false;
                this.deptAdd = false;
                // this.adminAdd = false;
                this.details = false;
                this.paied = false;
                document.getElementById("list1").classList.add("click1");
                this.removeClicklClassName(num);

                this.rateManage();
            },
            statiticsShow: function (num) {
                this.home = false;
                this.freightManagement = false;
                this.statistics = true,
                    this.salary = false;
                this.manager = false;
                this.deptAdd = false;
                // this.adminAdd = false;
                this.details = false;
                this.paied = false;
                document.getElementById("list2").classList.add("click1");
                this.removeClicklClassName(num);
                //楼栋分页
                this.buildingListQuery(1);
            },
            salaryShow: function (num) {
                this.home = false;
                this.freightManagement = false;
                this.statistics = false;
                this.salary = true;
                this.manager = false;
                this.deptAdd = false;
                // this.adminAdd = false;
                this.details = false;
                this.paied = false;
                document.getElementById("list3").classList.add("click1");
                this.removeClicklClassName(num);
                this.unPaiedQuery(1);
            },
            managerShow: function (num) {
                this.home = false;
                this.freightManagement = false;
                this.statistics = false;
                this.salary = false;
                this.manager = true;
                this.deptAdd = false;
                // this.adminAdd = false;
                this.details = false;
                this.paied = false;
                document.getElementById("list4").classList.add("click1");
                this.removeClicklClassName(num);
                
                this.roomControlPageNum = 1;
                this.roomListQuery(1);
            },
            deptAddShow: function () {
                this.home = false;
                this.freightManagement = false;
                this.statistics = false;
                this.salary = false;
                this.manager = false;
                this.deptAdd = true;
                // this.adminAdd = false;
                this.details = false;
                this.paied = false;
            },
            paiedShow: function (num) {
                this.home = false;
                this.freightManagement = false;
                this.statistics = false;
                this.salary = false;
                this.manager = false;
                this.deptAdd = false;
                // this.adminAdd = false;
                this.details = false;
                this.paied = true;
                document.getElementById("list5").classList.add("click1");
                this.removeClicklClassName(num);
                this.payControlPageNum = 1;
                this.paiedListQuery(this.payControlPageNum);
                
            },
           
            //移除点击后的css样式
            removeClicklClassName: function (num) {
                var list = document.querySelectorAll(".menu>ul>li");

                for (let i = 0; i < list.length; i++) {

                    if (i != num) {

                        list[i].classList.remove("click1");
                    }

                }
            },
            //关闭窗口
            close: function (num) {
                //num 需要关闭的窗口 1 用户新增 2 用户详情 3用户状态修改 4批量修改房间状态 
                if (num == 1) {
                    this.deptAdd = false;
                    this.home = true;
                } else if (num == 2) {
                    this.details = false;
                    this.home = true;
                }else if (num == 3) {
                    this.changeUserStatusPop = false; 
                    this.home = true;
                }else if(num == 4){
                    this.roomId=[];
                    this.bacthchangeRoomStatusPop=false;
                    //取消勾选所有复选框
                    document.getElementById("roomAll").checked=false;
                    var list = document.querySelectorAll(".staff_div>div>ul>li>input");
                    for (let i = 0; i < list.length; i++) {
                       list[i].checked = false;
                    }
                    this.roomListQuery(this.roomControlPageNum);
                }else if(num == 5){
                    this.buildingIds = [];
                    this.bacthchangeBuildingStatusPop = false;
                    document.getElementById("buildingAll").checked=false;
                    var list = document.querySelectorAll(".builing_ul>li>input");
                    for (let i = 0; i < list.length; i++) {
                       list[i].checked = false;
                    }
                    this.buildingListQuery(this.buildingControlPageNum);
                }
                
            },
            //房间全选
            selectAll: function (id,num) {
                //num:1房间全选id，2楼栋去哪选id
                
                var checkedAll = document.getElementById(id);
                if(num == 1){
                    //房间全选
                    var list = document.querySelectorAll(".staff_div>div>ul>li>input");
                    
                    if (checkedAll.checked) {
                        for (let i = 0; i < list.length; i++) {
                            list[i].checked = true;
                            //全选把房间id放入列表中
                            this.roomId.push(list[i].value);
                        }
                    } else {
                        for (let i = 0; i < list.length; i++) {
                            list[i].checked = false;
                            
                        }
                        //取消全选移除
                        this.roomId=[];
                    }
                }else if( num==2){
                    //楼栋全选
                    var list = document.querySelectorAll(".builing_ul>li>input");
                    
                    if (checkedAll.checked) {
                        for (let i = 0; i < list.length; i++) {
                            list[i].checked = true;
                            //全选把房间id放入列表中
                            this.buildingIds.push(list[i].value);
                        }
                    } else {
                        for (let i = 0; i < list.length; i++) {
                            list[i].checked = false;
                            
                        }
                        //取消全选移除
                        this.buildingIds=[];
                    }
                }
            },
           
            //选择框点击事件
            checkBoxClick:function(ele,id,num){
                if(num == 1){
                    var roomAllBox =  document.getElementById("roomAll");
              
                    if(!ele.checked){
                        //取消房间全选
                        roomAllBox.checked=false;
                        //并移除元素
                        this.roomId = this.roomId.filter(item => item != id)
                    }else{
                        //勾选把id房间数组
                        this.roomId.push(id)
                        //判断是否勾选全选
                        var list = document.querySelectorAll(".staff_div>div>ul>li>input");
                        var count = 0;
                        for (let i = 0; i < list.length; i++) {
                            if(list[i].checked){
                                count++;
                            }
                            
                        }
                        if(count == list.length){
                            roomAllBox.checked=true;
                        }
                    }
                }else if(num == 2){
                    var buildingAllBox =  document.getElementById("buildingAll");
                    if(!ele.checked){
                        //取消房间全选
                        buildingAllBox.checked=false;
                        //并移除元素
                        this.buildingIds = this.buildingIds.filter(item => item != id)
                    }else{
                        //勾选把id房间数组
                        this.buildingIds.push(id)
                        //判断是否勾选全选
                        var list = document.querySelectorAll(".builing_ul>li>input");
                        var count = 0;
                        for (let i = 0; i < list.length; i++) {
                            if(list[i].checked){
                                count++;
                            }
                            
                        }
                        if(count == list.length){
                            buildingAllBox.checked=true;
                        }
                }
            }
            },

            //用户列表
            userList: function (current) {

                axios
                    .get(this.baseurl + "/user/pageOfOwner", {
                        params: {
                            current: current,
                            size: 10
                        }
                    })
                    .then(res => {
                        if (res.data.code == 1) {
                            this.userPage = res.data.data;
                        } else {
                            alert(res.data.message);
                        }
                    })
                    .catch((error) => {
                        alert(error.message);
                        console.log(error);
                    });
            },

            //新增业主
            addUser: function () {
                if (!this.username) {
                    alert("请输入用户名")
                    return;
                }
                if (!this.age) {
                    alert("请输入年龄")
                    return;
                }
                if (!this.gender) {
                    alert("请选择性别")
                    return;
                }
                if (!this.idcard) {
                    alert("请输入身份证号")
                    return;
                }
                if (!this.room) {
                    alert("请选择房间号")
                    return;

                }

                axios
                    .post(this.baseurl + "/user/insert",
                        {
                            age: this.age,
                            gender: this.gender,
                            idcard: this.idcard,
                            user_roomid: this.room,
                            username: this.username,
                        })
                    .then(res => {
                        if (res.data.code == 1) {
                            alert("添加成功");
                            this.deptAdd = false;
                            this.home = true;
                            this.userList(1);
                        } else {
                            alert(res.data.message);
                        }

                    })
                    .catch((error) => {
                        alert(error.message);

                    });

            },

            //填充建筑
            fillBuildings: function () {

                axios
                    .get(this.baseurl + "/building/buildingOfUsed", {})
                    .then(res => {
                        if (res.data.code == 1) {
                            this.buildings = res.data.data;
                        }
                    }).catch((error) => {
                        alert(error.message);
                        console.log(error);
                    });

            },

            //填充楼层
            fillFloors: function () {

                if (!this.building) {
                    alert("请先选择楼栋号")
                    return;
                }

                axios
                    .get(this.baseurl + "/floor/floorOfBuilding/" + this.building, {
                        buildingId : this.building
                    })
                    .then(res => {
                        if (res.data.code == 1) {
                            this.floors = res.data.data;
                        }
                    }).catch((error) => {
                        alert(error.message);
                        console.log(error);
                    });
            },

            //填充房间
            fillRooms: function () {

                if (!this.building) {
                    alert("请先选择楼栋号");
                    return;
                }

                if (!this.floor) {
                    alert("请先选择楼层号");
                    return;
                }

                axios
                    .get(this.baseurl + "/room/roomOfFloor/" + this.floor, {
                        floorId: this.floor
                    })
                    .then(res => {
                        if (res.data.code == 1) {
                            this.rooms = res.data.data;
                        }
                    }).catch((error) => {
                        alert(error.message);
                        console.log(error);
                    });
            },

            //详细信息页面展示
            userDetailBtn: function (id) {
                this.home = false;
                this.freightManagement = false;
                this.statistics = false;
                this.salary = false;
                this.manager = false;
                this.deptAdd = false;
                this.details = true;

                axios
                    .get(this.baseurl + "/user/id/" + id, {})
                    .then(res => {
                        if (res.data.code == 1) {
                            
                            this.userDetail = res.data.data;
                        }
                    })
                    .catch((error) => {
                        alert(error.message);
                        console.log(error);
                    });
            },
            //弹出修改状态弹窗
            popupChangeUserStatus:function(id,status){
                this.changeUserStatusPop= true;
                this.userID = id;
                this.oldStatus = status;
                
                
            },
            //用户状态修改
            changeUserStatus:function(){
                if(!this.newStatus){
                    alert("请先选择用户状态");
                    return;
                }

                axios
                .put(this.baseurl+"/user/updateStatus/"+this.userID,{
                    userid : this.userID,
                    user_status : this.newStatus
                })
                .then(res => {
                    if (res.data.code == 1) {
                        alert("修改成功");
                        this.userList(1);
                    }
                    this.changeUserStatusPop =false;
                }).catch((error) => {
                    alert(error.message);
                    console.log(error);
                });
            },
            //分页查询房间信息
            roomListQuery:function(current){
                
                axios
                .post(this.baseurl + "/room/pageOfRoom",{
                    current:current,
                    size:10
                })
                .then(res =>{
                    if(res.data.code == 1){
                        this.roomPage = res.data.data
                        
                    }
                })
                .catch((error) => {
                    alert(error.message);
                    console.log(error);
                });
            },
            //控制批量修改房间状态窗口打开
            batchChangeRoomStatusPop:function(){
                if(!this.roomId.length){
                    alert("请先选择需要修改的房间");
                    return;
                }
                //展示批量修改房间装填页面
                this.bacthchangeRoomStatusPop = true;
            },
            //批量修改房间装填发起请求
            batchChangeRoomStatus:function(){
                if(!this.roomStatus){
                    alert("请先选择房间状态");
                    return;
                }
                //去重
                const newArr = [];
                this.roomId.forEach(item => {
                    if (!newArr.includes(item)) {
                        newArr.push(item);
                    }
                })
               
                
                const idsStr = newArr.join(",");

                const params = new URLSearchParams();
                params.append('ids', idsStr);
                params.append('status', this.roomStatus);

                axios              
                .put(this.baseurl + "/room/updateStatus",params
                // {
                //     ids:newArr.toString(),
                //     status:this.roomStatus,
                    
                // }
                )
                .then(res =>{
                    if(res.data.code == 1){
                        alert("修改成功");
                    }else{
                        alert("修改失败");
                    }
                    this.bacthchangeRoomStatusPop=false;
                    //取消勾选所有复选框
                    document.getElementById("roomAll").checked=false;
                    var list = document.querySelectorAll(".staff_div>div>ul>li>input");
                    for (let i = 0; i < list.length; i++) {
                       list[i].checked = false;
                    }
                    this.roomListQuery(this.roomControlPageNum);
                }) 
                .catch((error) => {
                    alert(error.message);
                    console.log(error);
                });
            },
            //上一页
            prevPage:function(num){
                 if(num == 3){
                    if(this.roomControlPageNum>1){
                        this.roomControlPageNum--;
                    }
                    this.roomListQuery(this.roomControlPageNum);
                }else if(num == 2){
                    if(this.buildingControlPageNum>1){
                        this.buildingControlPageNum--;
                    }
                    this.buildingListQuery(this.buildingControlPageNum);
                }else if(num == 1){
                    if(this.userControlPageNum>1){
                        this.userControlPageNum--;
                    }
                    this.userList(this.userControlPageNum);
                }else if(num ==4){
                    if(this.unPaiedControlPageNum>1){
                        this.unPaiedControlPageNum--;
                    }
                    this.unPaiedQuery(this.unPaiedControlPageNum);
                }else if(num == 5){
                    if(this.payControlPageNum>1){
                        this.payControlPageNum--;
                    }
                    this.paiedListQuery(this.payControlPageNum);
                }
            
            },
            //下一页
            nextPage:function(num){
                if(num == 3){
                    if(this.roomControlPageNum < this.roomPage.total/this.roomPage.pageSize){
                        this.roomControlPageNum++;
                    }
                    this.roomListQuery(this.roomControlPageNum);
                }else if(num == 2){
                    if(this.buildingControlPageNum < this.buildingPage.total/this.buildingPage.pageSize){
                        this.buildingControlPageNum++;
                    }
                    this.buildingListQuery(this.buildingControlPageNum);
                }else if(num == 1){
                    if(this.userControlPageNum < this.userPage.total/this.userPage.pageSize){
                        this.userControlPageNum++;
                    }
                    this.userList(this.userControlPageNum);
                }else if(num == 4){
                    if(this.unPaiedControlPageNum < this.unPaiedPage.total/this.unPaiedPage.pageSize){
                        this.unPaiedControlPageNum++;
                    }
                    this.unPaiedQuery(this.unPaiedControlPageNum);
                }else if(num == 5){
                    if(this.payControlPageNum < this.payPage.total/this.payPage.pageSize){
                        this.payControlPageNum++;
                    }
                    this.paiedListQuery(this.payControlPageNum);
                }
            },
            //开始页
            startPage:function(num){
                
                if(num == 3){
                    this.roomControlPageNum = 1;
                    this.roomListQuery(1);
                }else if(num == 2){
                    this.buildingControlPageNum = 1;
                    this.buildingListQuery(1);
                }else if(num == 1){
                    this.userControlPageNum = 1;
                    this.userList(1);
                }else if(num == 4){
                    this.unPaiedControlPageNum = 1;
                    this.unPaiedQuery(1);
                }else if(num == 5){
                    this.payControlPageNum = 1;
                    this.paiedListQuery(1);
                }
            },
            //结束页
            endPage:function(total,size,num){
                //判断小数是否有小数
                var i = total / size;
                var current = 1;
                var j = i;
                if(j%1){
                    //有小数，向上取整
                    current = Math.ceil(i)
                }else{
                    //没有小数，向下取整
                    current = Math.floor(i)
                }
                
                if(num == 3){
                    this.roomControlPageNum = current;
                    this.roomListQuery(current);
                }else if(num == 2){
                    this.buildingControlPageNum = current;
                    this.buildingListQuery(current);
                }else if(num == 1){
                    this.userControlPageNum = current;
                    this.userList(current);
                }else if(num == 4){
                    this.unPaiedControlPageNum = current;
                    this.unPaiedQuery(current);
                }else if(num == 5){
                    this.payControlPageNum = current;
                    this.paiedListQuery(current);
                }
                
            },

            //费用查询
            rateManage: function(){
                axios
                .post(this.baseurl + "/freightBasis/queryAll",{})
                .then(res =>{
                    if(res.data.code == 1){
                        //只拿前三个属性
                        this.rate = Object.values(res.data.data).slice(0, 3)   
                    }else{
                        alert("查询失败");
                    }
                })
                .catch(error =>{
                    alert(error.message);
                    console.log(error);
                })
            },

            //费率修改
            updateFee: function(id){
                
                this.updateChangePop = true;
                this.feeID = id;
            },

            //费率修改
            changeFee: function(){
                if(!this.feeName && !this.feePrice && !this.feeIntro){

                    alert("三者不能同时为空");
                    return;
                }
                
                if((this.feePrice)&&!(new RegExp(/^([0-9]*)\.([\d]){2}$/).test(this.feePrice))){
                    alert("费用单价必须为两位小数");
                    return;
                }
                axios
                .put(this.baseurl + "/freightBasis/updateById"+(this.feePrice!=''?"?basisPrice="+this.feePrice:""),
                    {
                    freight_basis_id:this.feeID,
                        basis_name:this.feeName,
                        
                        intro:this.feeIntro,
                    }
                )
                .then(res =>{
                    if(res.data.code==1){
                        alert("修改成功");
                        this.rateManage();
                    }else{
                        alert("修改失败");
                    }
                    this.feeName= "";
                    this.feePrice="";
                    this.feeIntro="";
                    this.feeID= "";
                    this.rateManage();
                    this.updateChangePop = false;
                })
                .catch(error =>{
                    alert(error.message);
                    console.log(error);
                })
            },

            //建筑分页查询
            buildingListQuery:function(current){
               
                axios
                .get(this.baseurl + "/building/page/building",{
                    params:{
                        current:current,
                        size:10
                    }
                })
                .then(res =>{
                    if(res.data.code == 1){
                        this.buildingPage = res.data.data
                    }
                })
                .catch((error) => {
                    alert(error.message);
                    console.log(error);
                });
            },
            //新增单个建筑
            buildinginsert:function(){
                if(!this.buildingCode){
                    alert("请先输入建筑编码");
                    return;
                }
                if(!this.buildingName){
                    alert("请先输入建筑名称");
                    return;
                }
                if(!this.buildingFloors){
                    alert("请先输入楼层数");
                    return;
                }
                if(!this.buildingStatus){
                    alert("请先选择建筑状态");
                    return;
                }
                if(!this.completedDate){
                    alert("请先选择建成时间");
                    return;
                }
                if(!this.desginLife){
                    alert("请先输入设计年限");
                    return;
                }
                if(!this.ownership){
                    alert("请先输入设计年限");
                    return;
                }

                axios
                .post(this.baseurl+"/building/addBuilding",{
                    building_code:this.buildingCode,
                    building_name:this.buildingName,
                    building_floors:this.buildingFloors,
                    building_status:this.buildingStatus,
                    completed_date:this.completedDate,
                    design_life:this.desginLife,
                    ownership:this.ownership
                })
                .then(res =>{
                    if(res.data.code == 1){
                       alert("添加成功")
                       this.buildingListQuery(1);
                    }else{
                        alert(res.data.message)
                    }
                })
                .catch((error) => {
                    alert(error.message);
                    console.log(error);
                });
                this.insertSinglePop= false;
                this.buildingListQuery(this.buildingControlPageNum);
            },
            //批量添加建筑
            addbuildings:function(){
                if(!this.buildingCode){
                    alert("请先输入建筑编码");
                    return;
                }
                if(!this.buildingName){
                    alert("请先输入建筑名称");
                    return;
                }
                if(!this.buildingFloors){
                    alert("请先输入楼层数");
                    return;
                }
                if(!this.buildingStatus){
                    alert("请先选择建筑状态");
                    return;
                }
                if(!this.completedDate){
                    alert("请先选择建成时间");
                    return;
                }
                if(!this.desginLife){
                    alert("请先输入设计年限");
                    return;
                }
                if(!this.ownership){
                    alert("请先输入设计年限");
                    return;
                }
                if(!this.buildingSize){
                    alert("请先输入建筑个数");
                    return;
                }
                
                axios
                .post(this.baseurl+"/building/addBuildings?buildingSize="+this.buildingSize+"&builtArea="+this.buildingArea,
                {
                    // params:{
                    //     buildingSize:this.buildingSize,
                    //     builtArea:this.buildingArea
                    // },
                   
                        building_code:this.buildingCode,
                        building_name:this.buildingName,
                        building_floors:this.buildingFloors,
                        building_status:this.buildingStatus,
                        completed_date:this.completedDate,
                        design_life:this.desginLife,
                        ownership:this.ownership
                    
                    
                })
                .then(res =>{
                    if(res.data.code == 1){
                       alert("添加成功")
                       this.buildingListQuery(1);
                    }else{
                        alert(res.data.message)
                    }
                })
                .catch((error) => {
                    alert(error.message);
                    console.log(error);
                });
                this.addBuildingsPop = false;
                
            },
            //打开批量修改楼栋信息
            openBacthchangeBuildingStatusPop:function(){
                if(!this.buildingIds.length){
                    alert("请先选择需要修改的楼栋");
                    return;
                }
                this.bacthchangeBuildingStatusPop = true;
               
            },
            //批量修改楼栋状态
            batchChangeBuildingStatus:function(){
                if(!this.batchBuildingStatus){
                    alert("请先选择楼栋装态");
                    return;
                }
               //去重
               const newArr = [];
               this.buildingIds.forEach(item => {
                   if (!newArr.includes(item)) {
                       newArr.push(item);
                   }
               });
               const requestData = new URLSearchParams();
               requestData.append('idList', this.buildingIds);
               requestData.append('status', this.batchBuildingStatus);
               
              
               axios
               .put(this.baseurl+"/building/updateStatus",requestData.toString(),
               )
                .then(res =>{
                    if(res.data.code == 1){
                       alert("修改成功")
                       this.buildingListQuery(1);
                    }else{
                        alert(res.data.message)
                    }
                })
                .catch((error) => {
                    alert(error.message);
                    console.log(error);
                });
                this.bacthchangeBuildingStatusPop = false;
               
                //取消勾选所有复选框
                document.getElementById("buildingAll").checked=false;
                var list = document.querySelectorAll(".builing_ul>li>input");
                for (let i = 0; i < list.length; i++) {
                   list[i].checked = false;
                }
                
                
            },
            //欠费信息查询
            unPaiedQuery:function(current){
                axios
                .get(this.baseurl+"/user/unpaidOwnerList",{
                    params:{
                        current:current,
                        size:10,
                        typeId:this.unPaiedType
                    }
                })
                .then(res => {
                    if (res.data.code == 1) {
                        this.unPaiedPage = res.data.data;
                    }
                    this.changeUserStatusPop =false;
                }).catch((error) => {
                    alert(error.message);
                    console.log(error);
                });
            },
            paiedListQuery:function(current){

                var url = this.baseurl+"/pay/payInfos?current="+current+"&size=10";
                if(this.startDate){
                    url+="&start="+this.startDate;
                }
                if(this.endDate){
                    url+="&end="+this.endDate;
                }
                if(this.building){
                    url+="&buildingId="+this.building
                }
                if(this.floor){
                    url+="&floorId="+this.floor
                }
                if(this.pay_username){
                    url+="&username="+this.pay_username;
                }
                if(this.pay_idCard){
                    url+="&idCard="+this.pay_idCard;
                }
                axios
                .get(url,{
                    // params:{
                    //     current:current,
                    //     size:10,
                    //     start:this.startDate,
                    //     end:this.endDate,
                    //     buildingId:this.building,
                    //     floorId:this.floor,
                    //     username:this.pay_username,
                    //     idCard:this.pay_idCard
                    // }
                })
                .then(res => {
                    if (res.data.code == 1) {
                        this.payPage = res.data.data;
                    }
                    this.changeUserStatusPop =false;
                }).catch((error) => {
                    alert(error.message);
                    console.log(error);
                });
                
            }
           
        }
        
        
    });
    Vue.filter("dateTimeFormat",function(dateTime){
        var y = dateTime.substring(0,4);
      
        var M = dateTime.substring(5,7);
        var d = dateTime.substring(8,10);
        // var H = (dateTime.getHours() + "").padStart(2,"0");
        // var m = (dateTime.getMinutes() + "").padStart(2,"0");
        // var s = (dateTime.getSeconds() + "").padStart(2,"0");

        //ES6以后 可以使用``拼接字符串 变量使用${}
        return `${y}-${M}-${d}`;
        // return `${y}-${M}-${d} ${H}:${m}:${s}`;
    })
    vm.userList(1);
    
}